#ifndef _VIEW_H_
#define _VIEW_H_

#include <SEUi/Widget/Widget.h>
#include <SERender/Renderer/Renderer.h>
#include <SERender/Resourses/FrameBuffer.h>
#include <memory>
#include <SERender/Entity/Camera.h>
#include <SECore/Signal.h>
#include <SECore/Plugin.h>


namespace SEngine
{
    class EditLayer;
    class View : public Widget
    {
    public:
        View(EditLayer &);
        virtual ~View() = default;
        Camera & GetCamera() { return m_editCamera; }
        Renderer & GetRenderer() { return *m_renderer; }
        void SetSelectActorByID(uint32_t id);
        void SetSelectActorByID(uint8_t id);
        void FocusSelectActor();
        void DeleteSelectActor();
    protected:
        virtual void BeginUpdate() override;
        virtual void UpdateImpl(int delta) override;
        virtual void EndUpdate() override;
        void ShowMenuBar();
        void DrawGizmo();

    public:
        Signal<Camera&> SignalCameraUpdate;
        Signal<glm::vec3> SignalFocusSelectActor;
        Signal<> SignalUpdateRenderPassSettingUI;

    private:
        std::unique_ptr<Renderer> m_renderer;
        std::unique_ptr<FrameBuffer> m_fbo;
        std::unique_ptr<Texture2D> m_targetMap;
        Camera m_editCamera;

        EditLayer & m_layer;

        std::shared_ptr<IPlugin> m_renderPipline;
    };
} // namespace SEngine


#endif